<template>
  <div class="stat-cards">
    <el-card class="stat-card" shadow="hover">
      <div class="stat-content">
        <div class="stat-info">
          <h3>全部</h3>
          <div class="stat-number">{{ orderStats.total || 0 }}</div>
        </div>
        <div class="stat-icon total">
          <el-icon><Document /></el-icon>
        </div>
      </div>
    </el-card>
    
    <el-card class="stat-card" shadow="hover">
      <div class="stat-content">
        <div class="stat-info">
          <h3>待发货</h3>
          <div class="stat-number">{{ orderStats.pending || 0 }}</div>
        </div>
        <div class="stat-icon pending">
          <el-icon><Clock /></el-icon>
        </div>
      </div>
    </el-card>
    
    <el-card class="stat-card" shadow="hover">
      <div class="stat-content">
        <div class="stat-info">
          <h3>运输中</h3>
          <div class="stat-number">{{ orderStats.processing || 0 }}</div>
        </div>
        <div class="stat-icon processing">
          <el-icon><Van /></el-icon>
        </div>
      </div>
    </el-card>
    
    <el-card class="stat-card" shadow="hover">
      <div class="stat-content">
        <div class="stat-info">
          <h3>待签收</h3>
          <div class="stat-number">{{ orderStats.completed || 0 }}</div>
        </div>
        <div class="stat-icon completed">
          <el-icon><Bell /></el-icon>
        </div>
      </div>
    </el-card>
    
    <el-card class="stat-card" shadow="hover">
      <div class="stat-content">
        <div class="stat-info">
          <h3>已完成</h3>
          <div class="stat-number">{{ orderStats.deliverying || 0 }}</div>
        </div>
        <div class="stat-icon deliverying">
          <el-icon><Check /></el-icon>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { Document, Van, Check, Bell, Clock } from '@element-plus/icons-vue'

interface OrderStats {
  total: number
  pending: number
  processing: number
  completed: number
  deliverying: number
}

defineProps<{
  orderStats: OrderStats
}>()
</script>

<style scoped>
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.stat-card {
  border-radius: 8px;
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.stat-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-info h3 {
  font-size: 14px;
  color: #909399;
  margin: 0 0 10px 0;
}

.stat-number {
  font-size: 24px;
  font-weight: 600;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.stat-icon.total {
  background-color: #409EFF;
}

.stat-icon.pending {
  background-color: #E6A23C;
}

.stat-icon.processing {
  background-color: #F56C6C;
}

.stat-icon.completed {
  background-color: #F56C6C;
}

.stat-icon.deliverying {
  background-color: #67C23A;
}

@media (max-width: 768px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }
}
</style>